package com.xianniu.ltc.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xianniu.ltc.model.entity.TRbhetong0DTO;
import com.xianniu.ltc.model.po.AddProjectReportPO;
import com.xianniu.ltc.model.po.QueryRbHeTongPO;
import com.xianniu.ltc.model.po.report.ChartCommonPermissionsPO;
import com.xianniu.ltc.model.vo.CashTransferSchemesVO;
import com.xianniu.ltc.model.vo.statistics.BenNianQianYueEVO;
import com.xianniu.ltc.model.vo.TRbhetong0VO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @description 客户表
 * @author zhangyang@zencor.cn
 * @date 2021-05-19
 */
@Mapper
public interface TRbhetong0Mapper extends BaseMapper<TRbhetong0DTO> {

    IPage<TRbhetong0VO> selectPageList(@Param("page") Page page, @Param("po") QueryRbHeTongPO po);

    /**
     * 采购云查询框架协议
     * @param page
     * @param po
     * @return
     */
    IPage<TRbhetong0VO> selectFrameworkPageList(@Param("page") Page page, @Param("po") QueryRbHeTongPO po);

    /**
     * 通过收款流水关联查询销售合同的商机ID
     * @param collectingWaterId
     * @return
     */
    String selectByCollectingWaterId(String collectingWaterId);

    /**
     * 通过采购合同id关联查询销售合同中的商机ID
     * @param purchaseContractId
     * @return
     */
    String selectByPurchaseContractId(String purchaseContractId);

    /**
     * 通过回款计划ID查询商机编号
     * @param collectionPlanId
     * @return
     */
    @InterceptorIgnore(tenantLine = "on")
    String selectByCollectionPlanId(String collectionPlanId);

    /**
     * 查询回款单金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> rbHuiKuanDan();

    /**
     * 查询销售合同金额含税
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<TRbhetong0DTO> rbHeTong(@Param("projectCode") String projectCode);

    /**
     * 回款金额-项目金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> rbHeTongProjectM();

    /**
     * 查询付款单付款金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> rbFuKuanDan();

    /**
     * 查询回款计划已开票金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> huiKuanJiHua();

    /**
     * 已通过的项目类付款金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> xiangMuLeiFuKuanApproval();

    /**
     * 项目类付款投标费用(标书费、中标服务费、投标费用)
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> xiangMuLeiFuKuanTender();

    /**
     * 项目类报销投标费用
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> xiangMuLeiBaoXiaoTender();

    /**
     * 销售分佣任务内实际已提取金额
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> rbFenyongExtract();

    /**
     * 项目类付款非投标费用(标书费、中标服务费、投标费用)
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> xiangMuLeiFuKuanNoTender();

    /**
     * 项目类报销非投标费用
     * @throws Exception
     */
    @InterceptorIgnore(tenantLine = "on")
    List<AddProjectReportPO> xiangMuLeiBaoXiaoNoTender();

    /**
     * 统计-本年-各地域-签约额
     * @return
     */
    @InterceptorIgnore(tenantLine = "on")
    List<BenNianQianYueEVO> queryNowYearCityTop( @Param("po") ChartCommonPermissionsPO po );

    /**
     * 统计-本年-各客户-签约额
     * @return
     */
    List<BenNianQianYueEVO> queryNowYearKeHuTop(@Param("po") ChartCommonPermissionsPO po);

    /**
     * 统计-本年-各销售部门-签约额
     * @return
     */
    List<BenNianQianYueEVO> queryNowYearXiaoShouBuMen(@Param("po") ChartCommonPermissionsPO po, @Param("nameList") List<String> nameList );

    /**
     * 统计-本年-周-前5周-签约额
     * @return
     */
    List<BenNianQianYueEVO> queryNowYearWeek(@Param("po") ChartCommonPermissionsPO po, @Param("weekList") int[] weekList );

    /**
     * 统计-本年-月-签约额
     * @return
     */
    List<CashTransferSchemesVO> queryNowYearMonth(@Param("po") ChartCommonPermissionsPO po );


}

